<template>
  <div>
    <wangEditor ref="ediRef" :isRead="isRead" @getText="getText"></wangEditor>

    <div>
      <el-button @click="getMsg">点我获取消息</el-button>
    </div>

    <div>
      <el-button @click="read">切换为只读模式</el-button>
    </div>
  </div>
</template>
<script setup>
import wangEditor from "@/views/module/wangEditor.vue";
import { ref, onMounted } from "vue";

//输入的内容
const content = ref();

//文本框组件引用
const ediRef = ref(null);

const isRead = ref(false)
//子组件声明的事件
let getText = (text) => {
  content.value = text;
};

//
let getMsg = () => {
  console.log(content.value);
};

//只读模式
let read = () => {
  isRead.value = !isRead.value
}

//初始化显示内容
let init = () => {
  ediRef.value.getData(2);
};

onMounted(() => {
  init();
});
</script>
<style scope></style>
